#!/bin/bash

set -e

rm -rf bin

cleanup_exit() {
  echo "Test failed"
  exit ${1}
}

echo "Build should succeed"
../../build.py build ... || cleanup_exit 1

touch BUILD

echo "Build should succeed"
../../build.py build ... || cleanup_exit 1

echo "Build should succeed"
../../build.py build ... || cleanup_exit 1

find bin | sort | diff expected_files - || cleanup_exit 1

rm -rf bin

echo 'Test passed'
